/*
 *    Copyright © OpenAtom Foundation.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package com.inspur.edp.bef.dtgenerator.core.mgrImpl.mgrActionAssembler;

import com.inspur.edp.bef.bizentity.operation.BizMgrAction;
import com.inspur.edp.caf.generator.baseInfo.ParameterInfo;
import com.inspur.edp.caf.generator.baseInfo.TypeInfo;
import com.inspur.edp.caf.generator.method.ClassMethodGenerator;
import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.Modifier;

//
//     * public override void  demandFuncPermission()
//     * {
//     *
//     *     base.InnerDemandFuncPermission("opId");
//     * }
//
public class MgrAssDemandPermissionGenerator extends ClassMethodGenerator {
  public static final String ItemName = "demandFuncPermission";
  private BizMgrAction action;

  public MgrAssDemandPermissionGenerator(BizMgrAction action) {
    this.action = action;
  }

  @Override
  protected java.util.ArrayList<Modifier.ModifierKeyword> getAccessModifiers() {
    return new java.util.ArrayList<Modifier.ModifierKeyword>(
        java.util.Arrays.asList(
            Modifier.ModifierKeyword.PUBLIC_KEYWORD));
  }

  @Override
  protected boolean getIsOverride() {
    return true;
  }

  @Override
  protected String getMethodName() {
    return ItemName;
  }

  @Override
  protected java.util.ArrayList<ParameterInfo> getParameterCollection() {
    return new java.util.ArrayList<ParameterInfo>(1);
  }

  @Override
  protected TypeInfo getReturnType() {
    return new TypeInfo(void.class.getTypeName());
  }

  @Override
  protected Block buildMethodBody() {
    //    if (DotNetToJavaStringHelper.isNullOrEmpty(action.getFuncOperationID()))
    //    {
    return ast.newBlock();
    //    }
    // Java版临时注释：权限。
    //    return SyntaxFactory.Block(
    //        SyntaxFactory.<StatementSyntax>SingletonList(
    //            SyntaxFactory.ExpressionStatement(
    //                SyntaxFactory.InvocationExpression(
    //                        SyntaxFactory.MemberAccessExpression(
    //                            SyntaxKind.SimpleMemberAccessExpression,
    //                            TypeUtils.GetTypeSyntax(AuthUtil.class),
    //                            SyntaxFactory.IdentifierName("demandFuncPermission")))
    //                    .WithArgumentList(
    //                        SyntaxFactory.ArgumentList(
    //                            SyntaxFactory.<ArgumentSyntax>SingletonSeparatedList(
    //                                SyntaxFactory.Argument(
    //                                    SyntaxFactory.LiteralExpression(
    //                                        SyntaxKind.StringLiteralExpression,
    //                                        SyntaxFactory.Literal(action.FuncOperationID)))))))));
  }
}
